<template>
    <div>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>公告类型</td>
                    <td>
                        <input type="text" v-model="query.typeName">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="添加" class="btn btn-info" @click="ok">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue'
import axios from 'axios';
import {useRoute,useRouter} from 'vue-router'
import moment from 'moment';
import router from '@/router';
const Route=useRoute();
const Router=useRouter();

//添加
const query=reactive({
    "typeName": ""
})
const ok=()=>{
  axios({
      method:'post',
      url:'/api/GongGao/GTypeAdd',
      data:query,
  })
  .then(res=>{
      console.log(res);
     if(res.data>0){
      alert("添加成功");
      Router.push('/gonggaoAdd')
      return;
     }
     else{
      alert("添加失败");
     }
  })
  .catch(err=>{
      console.log(err);
  })
}

</script>

<style scoped>

</style>